package com.shop.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;
import lombok.ToString;

/**
 * 用户表
 *
 * @author yukangkang
 * @email sunlightcs@gmail.com
 * @date 2020-10-30 13:16:29
 */
@Data
@ToString
@TableName("users")
public class Users implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id 用户id
     */
    @TableId(value = ID)
    private String id;
    /**
     * 用户名 用户名
     */
    @TableField(USERNAME)
    private String username;
    /**
     * 密码 密码
     */

    @TableField(PASSWORD)
    @JsonIgnore
    private String password;
    /**
     * 昵称 昵称
     */
    @TableField(NICKNAME)
    private String nickname;
    /**
     * 真实姓名
     */
    @TableField(REALNAME)
    @JsonIgnore
    private String realname;
    /**
     * 头像
     */
    @TableField(FACE)
    private String face;
    /**
     * 手机号 手机号
     */
    @TableField(MOBILE)
    private String mobile;
    /**
     * 邮箱地址 邮箱地址
     */
    @TableField(EMAIL)
    private String email;
    /**
     * 性别 性别 1:男  0:女  2:保密
     */
    @TableField(SEX)
    private Integer sex;
    /**
     * 生日 生日
     */
    @TableField(BIRTHDAY)
    private Date birthday;
    /**
     * 创建时间 创建时间
     */
    @TableField(value = CREATED_TIME, fill = FieldFill.INSERT)
    private Date createdTime;
    /**
     * 更新时间 更新时间
     */
    @TableField(value = UPDATED_TIME, fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;


    public final static String ID = "`id`";
    public final static String USERNAME = "`username`";
    public final static String PASSWORD = "`password`";
    public final static String NICKNAME = "`nickname`";
    public final static String REALNAME = "`realname`";
    public final static String FACE = "`face`";
    public final static String MOBILE = "`mobile`";
    public final static String EMAIL = "`email`";
    public final static String SEX = "`sex`";
    public final static String BIRTHDAY = "`birthday`";
    public final static String CREATED_TIME = "`created_time`";
    public final static String UPDATED_TIME = "`updated_time`";


    public final static String ID_COMMENT = "主键id 用户id";
    public final static String USERNAME_COMMENT = "用户名 用户名";
    public final static String PASSWORD_COMMENT = "密码 密码";
    public final static String NICKNAME_COMMENT = "昵称 昵称";
    public final static String REALNAME_COMMENT = "真实姓名";
    public final static String FACE_COMMENT = "头像";
    public final static String MOBILE_COMMENT = "手机号 手机号";
    public final static String EMAIL_COMMENT = "邮箱地址 邮箱地址";
    public final static String SEX_COMMENT = "性别 性别 1:男  0:女  2:保密";
    public final static String BIRTHDAY_COMMENT = "生日 生日";
    public final static String CREATED_TIME_COMMENT = "创建时间 创建时间";
    public final static String UPDATED_TIME_COMMENT = "更新时间 更新时间";


    public static Users of(Object obj) {
        Users e = new Users();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<Users> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }


}
